package seismosurfer.util;

/**
 * An error message representation for
 * errors caused by the users.
 *
 */
public class UserError {
    
    /** The name of the default CSS class that is used to depict errors */
    public static final String CSS_ERROR_CLASS = "error";

    private String cssClass;

    private String message;
    
    /**
     * Creates a UserError object with the
     * the given CSS error class and the
     * error message.
     * 
     * @param css the String that contains the CSS error class name
     * @param message the error message
     */
    public UserError(String css, String message) {
        Assert.notNull(css, "CSS class should not be null.");
        Assert.notNull(message, "Error message should not be null.");

        cssClass = css;
        this.message = message;
    }

    public UserError(String message) {
        this(CSS_ERROR_CLASS, message);
    }

    public String getCSSClass() {
        return cssClass;
    }

    public String getMessage() {
        return message;
    }

    public String toString() {
        return message;
    }

}